﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - EBlog</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" />
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script type="text/javascript">
        
        $(function () {

            var strHtml = "";
            $.post("/Blog/GetImg", { userName:"@User.Identity.Name" }, function (data) {
                var list = eval("(" + data + ")");
                var imageData = 'data:image/png;base64,' + list['BaseData'];
                strHtml = `<img src=${imageData} id="img-change" alt="" style="width:60px;height:60px;border-radius:50%;overflow:hidden">`
                $("#ViewImg").append(strHtml);
                // var imgWindow = $("#imgDetail").html("<img src="+imageData+">");
                // $("#headImage").html('<img src="data:image/png;base64,' + ret.data + '"/>')

            });
        });

    </script>

</head>
<body>
   
    <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">EBlog</a>
                <a class="navbar-brand" asp-area="" asp-controller="Account" asp-action="EchartsInfo">图表</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">

                    @if (User.Identity.IsAuthenticated)
                    {
                        <!-- Example split danger button -->
                        <div id="ViewImg" style="margin:10px"></div>
                        <div class="btn-group">
                            <button class="btn btn-secondary btn-small dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                欢迎您！<span style="font-family:'Microsoft YaHei';color:red;font-size:large">@User.Identity.Name</span>
                            </button>
                            <div class="dropdown-menu" style="text-align:center">
                                <a class="dropdown-item" asp-area="" asp-controller="Account" asp-action="ChangePassword">修改密码</a>
                                <a class="dropdown-item" asp-area="" asp-controller="Account" asp-action="SetHeaderImg">设置头像</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" asp-area="" asp-controller="Account" asp-action="Logout">退出</a>
                            </div>
                        </div>

                        <ul class="navbar-nav flex-grow-1">

                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Blog" asp-action="Index">我的博客</a>
                            </li>
                        </ul>
                        @*<li class="nav-item">
                <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="ChangePassword">修改密码</a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="SetHeaderImg">设置头像</a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Logout">退出</a>
            </li>*@
                    }
                    else
                    {
                        <ul class="navbar-nav flex-grow-1">

                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Register">注册</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Login">登录</a>
                            </li>
                        </ul>
                    }

                </div>
            </div>
        </nav>
    </header>

    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>


    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2020 - <a asp-area="" asp-controller="Home" asp-action="Index">EBlog</a>
        </div>
    </footer>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    <script src="~/js/My.js" asp-append-version="true"></script>
    @RenderSection("Scripts", required: false)
</body>
</html>
